//
//  MineView.m
//  SimpleTimeDemo
//
//  Created by lanou3g on 15/11/16.
//  Copyright © 2015年 王丽珍. All rights reserved.
//

#import "MineView.h"

@interface MineView () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *mineTableView;

@property (nonatomic, strong) UISegmentedControl *mineSegment;

@end

@implementation MineView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.mineSegment = [[UISegmentedControl alloc] initWithItems:@[@"参与的话题", @"加入的小组"]];
        self.mineTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 30, self.frame.size.width, self.frame.size.height - 94) style:UITableViewStylePlain];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.mineSegment.selectedSegmentIndex = 0;
    self.mineSegment.frame = CGRectMake(50, 0, self.frame.size.width - 2*50, 25);
    [self addSubview:self.mineSegment];
    
    [self loadTableView];
}

- (void)loadTableView {
    self.mineTableView.delegate = self;
    self.mineTableView.dataSource = self;
    [self addSubview:self.mineTableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.mineTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CELL"];
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL" forIndexPath:indexPath];

    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}
@end
